Skip to content

Refactor ExprBeaconValues into multiple expressions, fix bugs. #7729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: dev/feature
Choose a base branch
from

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Mar 20, 2025

Description

ExprBeaconValues is an expression that tries to do too many things at once. Since it's trying to handle potion effects, range, and tier all at once, it is very large and overly complex for what it needs to be. This complexity led to multiple bugs not being caught in testing or review, like failing to check if the block state is a beacon before casting it and returning Object.class in acceptChange, which led to lines like set primary effect of {block} to "hello world" being parsed with no errors.

This PR splits the expression into its component parts (ExprBeaconEffects, ExprBeaconTier, ExprBeaconRange) which allows the code to be much simpler in each class. The bugs mentioned above are fixed.

There is a breaking change in the syntax, [beacon] range/tier -> beacon range/tier as I thought that the expressions were too generic without the beacon prefix. Let me know if you disagree or think it not worth changing. The DELETE mode was also removed from the range expression, as deleting a range doesn't make much sense to me.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@sovdeeth sovdeeth added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) labels Mar 20, 2025
@sovdeeth sovdeeth requested a review from a team as a code owner March 20, 2025 20:28
@sovdeeth sovdeeth requested a review from APickledWalrus May 13, 2025 23:24
@sovdeeth sovdeeth moved this to In Review in 2.12 Release May 14, 2025
@skriptlang-automation skriptlang-automation bot added needs reviews A PR that needs additional reviews and removed needs reviews A PR that needs additional reviews labels May 15, 2025
@sovdeeth sovdeeth moved this from Awaiting Merge to Needs Reviews in 2.12 Release Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants